package com.cabinet.db;

import com.cabinet.Device;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 * User: denny
 * Date: 10/1/13
 * Time: 6:47 PM
 * To change this template use File | Settings | File Templates.
 */
public class DBConferenceCfg {
  String name = "";
  List<DBDeviceState> devStates = new ArrayList<>();

  public void initDevices(){
    for( Device d : Device.all() ){
      DBDeviceState s = new DBDeviceState();
      s.setDevId(d.getId());
      devStates.add(s);
    }
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public List<DBDeviceState> getDevStates() {
    return devStates;
  }
  
  public Map<Long,DBDeviceState> devStatesMap(){
    Map<Long,DBDeviceState> m = new HashMap<Long,DBDeviceState>();
    for( DBDeviceState d : devStates ){
      m.put(d.getDevId(), d);
    }
    return m;
  }

  public void setDevStates(List<DBDeviceState> devStates) {
    this.devStates = devStates;
  }
}
